<!--Login panel-->
<div id="email_empty_panel" class="reveal-modal">
    <div class="row">
        <div class="twelve columns">
            <h5 class="pink-text"><i class="icon-user icon-large"></i> INGRESE A SU EMAIL</h5>
        </div>
			<form novalidate id="email_empty_form_panel" action="{{ path('user_save_email') }}" method="POST" class="clearfix" onsubmit="return saveEmptyEmail();">
			<div class="twelve columns alert-box alert errors"></div>
            <div class="six columns">
                <input type="email" name="email" class="inputbox" placeholder="Email" required>
            </div>
			
			<p class="twelve columns">
                <small><i class="icon-lock"></i>
                    Su email es indispensable para poder contactarnos con usted.
                </small>
            </p>
            <div class="twelve columns">
                <button id="btn_email_empty_panel" type="submit" name="submit" class="radius secondary button"><i class="icon-unlock"></i> &nbsp;Guardar</button> &nbsp;
            </div>
        </form>
    </div><!--end row-->
</div><!--end login panel-->


<script>
	
	$(function() {
		$('#email_empty_panel').reveal({
			closeOnBackgroundClick: 0
		});
	});
	
	function saveEmptyEmail()
	{
		$("#btn_email_empty_panel").attr('disabled',true);
		$("#email_empty_panel .alert.errors").html('');
		$("#email_empty_panel .alert.errors").hide();

		var form = $("#email_empty_form_panel");
		showLoadig();
		$.ajax({
			type: form.attr('method'),
			url: form.attr('action'),
			data: form.serialize()
		}).done(function(o) {
			$("#btn_email_empty_panel").attr('disabled',false);
			if(o.valid)
			{
				window.location.href = o.url;
			} else {
				$("#email_empty_panel .alert.errors").show();
				$("#email_empty_panel .alert.errors").append( $('<ul/>').append($('<li/>').html(o.message))  );
			}
			hideLoadig();
		}).fail(function() {
			$("#btn_email_empty_panel").attr('disabled',false);
			hideLoadig();
		});

		return false;
	
	}
	

</script>
